package com.mrdeer.user.convert;

import com.mrdeer.user.api.dto.authorization.RoleDTO;
import com.mrdeer.user.api.entity.AuthorizationRole;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author ：xie jianchu
 * @date ：Created in 2020/9/7 0007 17:37
 */
@Mapper
public interface AuthorizationRoleConvert {

    AuthorizationRoleConvert INSTANCE = Mappers.getMapper(AuthorizationRoleConvert.class);

    @Mappings({
            @Mapping(target = "name", source = "name"),
            @Mapping(target = "code", source = "code"),
            @Mapping(target = "tenantId", source = "tenantId")
    })
    RoleDTO entity2Dto(AuthorizationRole entity);

    @Mappings({
            @Mapping(target = "name", source = "name"),
            @Mapping(target = "code", source = "code"),
            @Mapping(target = "tenantId", source = "tenantId")
    })
    AuthorizationRole dto2Entity(RoleDTO dto);

    List<RoleDTO> entityList2Dto(List<AuthorizationRole> authorizationRoles);

    List<AuthorizationRole> dtoList2Entity(List<RoleDTO> roleDTOS);
}
